package hk.ust.cse.comp4981;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.sql.Date;
import java.util.ArrayList;
import java.util.Timer;
import java.util.TimerTask;

import twitter4j.FilterQuery;
import twitter4j.StallWarning;
import twitter4j.Status;
import twitter4j.StatusDeletionNotice;
import twitter4j.StatusListener;
import twitter4j.TwitterException;
import twitter4j.TwitterStream;
import twitter4j.TwitterStreamFactory;

public class Result implements Comparable<Result>{
	private String strData;
	private float fScore;
	private int iNgram;
	private ArrayList<Result> alHit;
	
	public Result(){
		strData = null;
		fScore = 0.0f;
		alHit = new ArrayList<Result>();
	}

	public Result(String word, float score) {
		this.strData = word;
		this.fScore = score;

		this.iNgram = 1 + strData.length() - strData.replace(" ", "").length();
		
		this.alHit = new ArrayList<Result>();
	}
	
	public String getWord() {
		return strData;
	}

	public float getScore() {
		return fScore;
	}
	
	public int getNgram(){
		return iNgram;
	}
	
	public ArrayList<Result> getHit(){
		return alHit;
	}
	
	public String toString(){
		return String.format("Data: %s,\t Score: %.3f,\t Ngram: %d", strData, fScore, iNgram);
	}
	
	public int compareTo(Result r){
		
		return r.getHit().size() - this.alHit.size() ;
	}
}